package com.yunxin.core.application.service.impl;

import com.yunxin.core.application.assembler.OrderAssembler;
import com.yunxin.core.application.command.order.GetUserApplyOrderInfoCommand;
import com.yunxin.core.application.dto.order.UserApplyOrderInfoDTO;
import com.yunxin.core.application.service.OrderQueryGatewayService;
import com.yunxin.core.infra.persistence.entity.order.query.result.OrderUserApplyInfoResult;
import com.yunxin.core.infra.persistence.mapper.order.OrderUserApplyAllocationExtendMapper;
import com.yunxin.core.infra.persistence.mapper.order.OrderUserApplyExtendMapper;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * @author zero°
 * @since 2023-07-12
 */
@Service
@RequiredArgsConstructor
public class OrderQueryGatewayServiceImpl implements OrderQueryGatewayService {

    private final OrderUserApplyExtendMapper orderUserApplyExtendMapper;

    private final OrderUserApplyAllocationExtendMapper orderUserApplyAllocationExtendMapper;

    private final OrderAssembler orderAssembler;


    @Override
    public UserApplyOrderInfoDTO getUserApplyOrderByUserAndProduct(GetUserApplyOrderInfoCommand request) {
        OrderUserApplyInfoResult result = orderUserApplyExtendMapper.selectOrderUserApplyDetailByUser(request.getUserCode());
        return orderAssembler.toUserApplyOrderInfoDTO(result);
    }

    @Override
    public String getOrderAllocationApiUrl(Long allocationOrderId) {
        return StringUtils.EMPTY;
    }
}
